<?php

namespace App\Http\Controllers\Api;

use App\Http\Controllers\Controller;
use App\Repositories\CourseStudentRepository;
use App\Requests\Api\Course\ListRequest;
use App\Requests\Api\Course\StoreRequest;
use App\Service\CommonService;
use App\Service\CourseService;
use App\Service\CourseStudentService;
use Illuminate\Http\Request;

class CourseController extends Controller
{
    protected $courseService;

    public function __construct(
        CourseService $courseService
    ){
        $this->courseService = $courseService;
    }

    /**
     * 课程列表
     * @param Request $request
     * @return array|false|string
     * @throws \App\Exceptions\CustomException
     */
    public function list(Request $request){
        CommonService::reqLog($request);
        try{
            $params = request(['course_name']);
            $courseInfo = $this->courseService->list($params);
        }catch (\Exception $exception){
            customError($exception->getMessage(),$exception->getCode());
        }
        return responseData($courseInfo['data'] ?? []);
    }


}
